package com.hljcert.data.service.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hljcert.data.service.system.entity.SysRolePermission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 角色权限表 Mapper 接口
 * </p>
 */
@Mapper
public interface SysRolePermissionMapper extends BaseMapper<SysRolePermission> {

    @Delete("delete from sys_role_permission where role_id = #{roleId}")
    Integer deleteByRoleId(@Param("roleId") String roleId);

    @Delete("delete from sys_role_permission where role_id = #{roleId} and permission_id = #{permissionId}")
    Integer deleteByRoleIdAndPermissionId(@Param("roleId") String roleId, @Param("permissionId") String permissionId);

    Integer insertBatch(@Param("list") List<SysRolePermission> list);

    @Select("select * from sys_role_permission where role_id = #{roleId}")
    List<SysRolePermission> selectListByRoleId(@Param("roleId") String roleId);
}
